package top.yokey.shopnc.model;

import top.yokey.shopnc.base.BaseConstant;
import top.yokey.base.base.BaseHttpClient;
import top.yokey.base.base.BaseHttpListener;

@SuppressWarnings("ALL")
public class GoodsModel {

    private final String ACT = "goods";
    private static volatile GoodsModel instance;

    public static GoodsModel get() {
        if (instance == null) {
            synchronized (GoodsModel.class) {
                if (instance == null) {
                    instance = new GoodsModel();
                }
            }
        }
        return instance;
    }

    public void goodsBody(String goodsId, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "goods_body")
                .add("goods_id", goodsId)
                .get(baseHttpListener);

    }

    public void goodsDetailed(String goodsId, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "goods_detail")
                .add("goods_id", goodsId)
                .get(baseHttpListener);

    }

    public void calc(String goodsId, String areaId, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "calc")
                .add("goods_id", goodsId)
                .add("area_id", areaId)
                .get(baseHttpListener);

    }

    public void goodsEvaluate(String goodsId, String type, String page, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "goods_evaluate")
                .add("goods_id", goodsId)
                .add("type", type)
                .add("page", BaseConstant.PAGE)
                .add("curpage", page)
                .get(baseHttpListener);

    }

    public void goodsList(String keyword, String order, String key, String priceFrom, String priceTo, String bId, String gcId, String page, BaseHttpListener baseHttpListener) {

        BaseHttpClient.get().ready(ACT, "goods_list")
                .add("keyword", keyword)
                .add("order", order)
                .add("key", key)
                .add("price_from", priceFrom)
                .add("price_to", priceTo)
                .add("b_id", bId)
                .add("gc_id", gcId)
                .add("page", BaseConstant.PAGE)
                .add("curpage", page)
                .get(baseHttpListener);

    }

}
